package com.qys.livesMall.shop.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qys.livesMall.common.constants.Constants;
import com.qys.livesMall.shop.dao.H2ShopLevelRecordDao;
import com.qys.livesMall.shop.mapper.H2ShopLevelRecordMapper;
import com.qys.livesMall.shop.modal.entity.H2ShopLevelRecord;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 升级缴纳保证金记录 服务实现类
 * </p>
 *
 * @since 2023-05-09
 */
@Service
public class H2ShopLevelRecordDaoImpl extends ServiceImpl<H2ShopLevelRecordMapper, H2ShopLevelRecord> implements H2ShopLevelRecordDao {


    public H2ShopLevelRecord getRecord(Long userId,Long shopId,Integer levelId){
        LambdaQueryWrapper<H2ShopLevelRecord> qw=new LambdaQueryWrapper<>();
        qw.eq(H2ShopLevelRecord::getUserId,userId);
        qw.eq(H2ShopLevelRecord::getShopId, shopId);
        qw.eq(H2ShopLevelRecord::getShopLevelId, levelId);
        qw.eq(H2ShopLevelRecord::getPayMoneyFlag, Constants.YesNoInt.NO);
        qw.last("limit 1");
        return getOne(qw);
    }

}
